
<?php

include ("httpHelper.php");

$url = "http://webforex.hermes.hexun.com/forex/quotelist?code=FOREX".$_GET['f'].$_GET['t']."&column=code,price,PriceWeight&callback=ongetjsonpforex&_=1509611870732";  
$result = curl_request($url);

$result=str_replace("ongetjsonpforex(","",$result);
$result=str_replace(");","",$result);
$obj=json_decode($result);
//echo $obj->Data[0];
$x2= $obj->Data[0][0];
//echo $x2[1];
if($x2[1]>0&&$x2[1]<10000){
    echo round($x2[1]/$x2[2],5);
}
else{
   $url="http://hq.sinajs.cn/rn=1514804332188list=fx_s".strtolower($_GET['f']).strtolower($_GET['t']);
$result = curl_request($url);
$result=str_replace("var hq_str_fx_susdcny=\"","",$result);
$result=str_replace("\";","",$result);
$result = explode(",",$result);
echo $result[1]; 
}

?>